import plotly.offline as pyo
from plotly.graph_objs import *
import chart_studio.plotly as py
import pandas as pd
from pandas import DataFrame
pyo.offline.init_notebook_mode()
C02 = py.get_figure('rmuir', 156)
pyo.iplot(C02)
C02['layout']['yaxis'].update({'ticksuffix' : ' Kt'})
pyo.iplot(C02)
C02['layout']['yaxis'].update({'tickprefix' : 'C02: ', 'title' : ''})
pyo.iplot(C02)
C02['layout']['yaxis'].update({'tickprefix' : '', 'title' : 'C02 Emissions'})
pyo.iplot(C02)
housePrices = pd.read_csv(r"../Data/RegionalHousePricesAndRanksJan16.csv")
housePrices.head()
| Date | South West_avg | South East_avg | London_avg | East of England_avg | West Midlands_avg | East Midlands_avg | Yorkshire and The Humber_avg | North West_avg | North East_avg | South West_rank | South East_rank | London_rank | East of England_rank | West Midlands_rank | East Midlands_rank | Yorkshire and The Humber_rank | North West_rank | North East_rank | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1995-01-01 | 54705.15790 | 64018.87894 | 74435.76052 | 56701.59610 | 45090.91026 | 45544.52227 | 44803.42878 | 43958.48001 | 42076.35411 | 4.0 | 2.0 | 1.0 | 3.0 | 6.0 | 5.0 | 7.0 | 8.0 | 9.0 |
| 1 | 1996-01-01 | 53373.21941 | 64057.17813 | 75341.92348 | 55033.23782 | 44886.62926 | 44618.55057 | 43460.63343 | 42599.17133 | 40789.94219 | 4.0 | 2.0 | 1.0 | 3.0 | 5.0 | 6.0 | 7.0 | 8.0 | 9.0 |
| 2 | 1997-01-01 | 57751.25499 | 69007.75473 | 83065.73641 | 59081.19696 | 47535.66472 | 46775.09426 | 44984.36803 | 44094.92509 | 42353.48494 | 4.0 | 2.0 | 1.0 | 3.0 | 5.0 | 6.0 | 7.0 | 8.0 | 9.0 |
| 3 | 1998-01-01 | 64148.08628 | 79976.21086 | 97913.84288 | 66899.05828 | 50368.36040 | 50771.31393 | 46763.00972 | 46308.63234 | 44245.70109 | 4.0 | 2.0 | 1.0 | 3.0 | 6.0 | 5.0 | 7.0 | 8.0 | 9.0 |
| 4 | 1999-01-01 | 69447.64997 | 87345.54483 | 105695.32480 | 71965.72065 | 52640.75590 | 53061.77692 | 47586.11332 | 47592.93309 | 45466.77004 | 4.0 | 2.0 | 1.0 | 3.0 | 6.0 | 5.0 | 8.0 | 7.0 | 9.0 |
EnglandAvgPrices = {'type' : 'scatter',
'x' : housePrices['Date'],
'y' : housePrices['London_avg']}
data = Data([EnglandAvgPrices])
layout = {'title' : 'Average house prices in London 1995-2016',
'xaxis' : {'title' : 'Year'},
'yaxis' : {'title' : 'Average price'}}
fig = Figure(data=data, layout=layout)
pyo.iplot(fig)
fig['layout']['yaxis'].update({'tickformat' : ','})
pyo.iplot(fig)
fig['layout']['yaxis'].update({'tickprefix' : '£'})
pyo.iplot(fig)
C02['layout']['xaxis'].update({'tickmode' : 'auto', 'nticks' : 12})
pyo.iplot(C02)
C02['layout']['xaxis'].update({'tickmode' : 'auto', 'nticks' : 3})
pyo.iplot(C02)
C02['layout']['xaxis'].update({'tickmode' : 'auto', 'nticks' : 5})
pyo.iplot(C02)
C02['layout']['xaxis'].update({'tickmode' : 'auto', 'nticks' : 12})
pyo.iplot(C02)